bitkeeper revision 1.304.1.6 (3f0bec943sH0UMOrLxjNzPbtI73ljA)
authorrac61@labyrinth.cl.cam.ac.uk <rac61@labyrinth.cl.cam.ac.uk>
Wed, 9 Jul 2003 10:21:08 +0000 (10:21 +0000)
committerrac61@labyrinth.cl.cam.ac.uk <rac61@labyrinth.cl.cam.ac.uk>
Wed, 9 Jul 2003 10:21:08 +0000 (10:21 +0000)
Add VBD show command

.rootkeys
tools/control/src/org/xenoserver/cmdline/Main.java
tools/control/src/org/xenoserver/cmdline/ParseVbdShow.java [new file with mode: 0644]
tools/control/src/org/xenoserver/control/VirtualBlockDevice.java

index 5ea616d2f1794b5d789849a251930deaab8dea44..889b726a81d90824e1c5c40281af5978cc4feccc 100644 (file)
--- a/.rootkeys
+++ b/.rootkeys
@@ -31,6 +31,7 @@
 3f05631dMY7PMkwSY7zBFelGJ8goVg tools/control/src/org/xenoserver/cmdline/ParsePhysicalList.java
 3f05631dYDFXv6mwNFAgz3ta9kShJA tools/control/src/org/xenoserver/cmdline/ParsePhysicalRevoke.java
 3f0bdfabfXM4tMbvmV06di5U-5FfqA tools/control/src/org/xenoserver/cmdline/ParseVbdCreate.java
+3f0bec93F_VDIcn9oeXwJYwydX20kg tools/control/src/org/xenoserver/cmdline/ParseVbdShow.java
 3f098761TRsbDk9woUM846Q6_F7EmA tools/control/src/org/xenoserver/cmdline/ParseVdCreate.java
 3f099009pmH9MFkRYwP2V1DfsqEwdg tools/control/src/org/xenoserver/cmdline/ParseVdDelete.java
 3f098761zh9WTV6LpRqcet3gqlXdtg tools/control/src/org/xenoserver/cmdline/ParseVdFree.java
index 922a3ca74c08ffbaee634b2dde249bffb5763738..3b8cc554b7873b6e3b229e8bfaec10ca3354887e 100644 (file)
@@ -35,7 +35,8 @@ public class Main {
       new ParseVdFree()
     };
   private static final CommandParser vbdcommands[] =
-    { new ParseVbdCreate()
+    { new ParseVbdCreate(),
+      new ParseVbdShow()
     };
   private static final CommandParser commands[] =
     { help,
diff --git a/tools/control/src/org/xenoserver/cmdline/ParseVbdShow.java b/tools/control/src/org/xenoserver/cmdline/ParseVbdShow.java
new file mode 100644 (file)
index 0000000..b89105d
--- /dev/null
@@ -0,0 +1,41 @@
+package org.xenoserver.cmdline;
+
+import java.util.Iterator;
+import java.util.LinkedList;
+
+import org.xenoserver.control.CommandFailedException;
+import org.xenoserver.control.Defaults;
+import org.xenoserver.control.Library;
+import org.xenoserver.control.VirtualBlockDevice;
+import org.xenoserver.control.VirtualDiskManager;
+
+public class ParseVbdShow extends CommandParser {
+    public void parse(Defaults d, LinkedList args)
+        throws ParseFailedException, CommandFailedException {
+        loadState();
+        Iterator i = VirtualDiskManager.IT.getVirtualBlockDevices();
+        System.out.println("key         dom vbd mode");
+        while (i.hasNext()) {
+            VirtualBlockDevice vbd = (VirtualBlockDevice) i.next();
+            System.out.println( vbd.getVirtualDisk().getKey()
+                    + "  "
+                    + Library.format(vbd.getDomain(), 3, false)
+                    + " "
+                    + Library.format(vbd.getVbdNum(), 3, false)
+                    + " "
+                    + vbd.getMode().toString());
+        }
+    }
+
+    public String getName() {
+        return "show";
+    }
+
+    public String getUsage() {
+        return "";
+    }
+
+    public String getHelpText() {
+        return "Show details of all mapped virtual block devices.";
+    }
+}
index e66753480e45e32201e8846fb74e76c32c6e2d22..6e7c64480a60389af67f041c356513a564f588f5 100644 (file)
@@ -39,28 +39,6 @@ public class VirtualBlockDevice {
         this.mode = mode;
     }
 
-    // TODO: get rid of this method
-    String dump(boolean title) {
-        StringBuffer sb = new StringBuffer();
-
-        if (title) {
-            sb.append("  key         dom vbd mode\n");
-        } else {
-            sb.append(
-                "  "
-                    + vd.getKey()
-                    + "  "
-                    + Library.format(domain, 3, false)
-                    + " "
-                    + Library.format(vbdNum, 3, false)
-                    + " "
-                    + mode.toString()
-                    + "\n");
-        }
-
-        return sb.toString();
-    }
-
     /**
      * Dump the virtual block device as XML.
      * @param out The writer to dump to.